package myFirstWinForm;

import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;

public class MyDialog extends JDialog {
	public MyDialog(Frame owner,String title,boolean modal,String label) {
		super(owner,title,modal);
		this.setSize(200, 150);
		
		this.setLocationRelativeTo(owner);		
		this.setLayout(new FlowLayout());
		JButton btnok=new JButton("ok");
		JLabel jl=new JLabel(label);
		this.add(btnok);
		this.add(jl);		
		btnok.addMouseListener(new MouseListener() {
			
			@Override
			public void mouseReleased(MouseEvent e) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void mousePressed(MouseEvent e) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void mouseExited(MouseEvent e) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void mouseEntered(MouseEvent e) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void mouseClicked(MouseEvent e) {
				MyDialog.this.dispose();			
			}
		});
	}
}
